package band.wukong.practice.urule.ext.console.servlet;

import band.wukong.practice.urule.ext.console.URIConst;
import com.bstek.urule.console.servlet.RenderPageServletHandler;
import com.bstek.urule.console.servlet.console.DebugMessageHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author wukong(wukonggg@139.com)
 */
@Component
public class LoginServletHandler extends RenderPageServletHandler {

    private static final Logger logger = LoggerFactory.getLogger(LoginServletHandler.class);

    @Resource(name = "urule.debugMessageHolder")
    private DebugMessageHolder debugMessageHolder;

    @Override
    public void execute(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        logger.debug("LoginServletHandler execute.");
        resp.sendRedirect(req.getContextPath() + URIConst.LOGIN_JSP);
    }

    @Override
    public String url() {
        return URIConst.LOGIN_HANDLER_URI;
    }

}
